<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript">
function redeleteCheck(no,currentPage){
	if(confirm(no + " 번 글을 삭제하시겠습니까?")){
		alert('삭제되었습니다.');
		location.href="reviewDeleteAction.action?no="+ no +"&currentPage="+ currentPage;
	}; 
}

function remodifyCheck(no,currentPage){
	if(confirm(no + " 번 글을 수정하시겠습니까?")){
		location.href="reviewModifyForm.action?no="+ no +"&currentPage="+ currentPage;
	}; 
}
function deleteCheck(no,currentPage,originno){
	if(confirm("작성하신 코멘트를 삭제하시겠습니까?")){
		alert('삭제되었습니다.');
		location.href="reviewDeleteAction2.action?no="+ no +"&currentPage="+ currentPage+"&originno="+originno;
	}; 
}
function commentCheck() {
	var frm = document.forms(0);
	if (frm.content.value == "") {
		alert("내용을 입력해주세요.");
		return false;
	}
	return true;
}
</script>

<script type="text/javascript">
	function open_win_noresizable(url, name)
	{
		var oWin = window.open(url, name, "scrollbars=no, status=no, resizable=no, width=300, height=150");
	}
</script>
<h2 class="page_title"><strong>After the meeting</strong></h2>
<div class="event_modul">
	
	<div class="image">
		<s:if test="resultClass.file_savname == null">
			<p class="align_c noImg">?</p>
		</s:if>
		<s:else>
			<img src="C:\\project_file\\reviewboard\\<s:property value="resultClass.file_savname"/>" />
		</s:else>
	</div><!-- image -->
	<div class="text">
		<p class="align_r">
			<b>NO</b> : <s:property value="resultClass.no" /> <b>DATE</b> : <s:property value="resultClass.regdate" />
		</p>
		<p class="align_r">
			<b>VIEWS</b> : <s:property value="resultClass.readhit" />
		</p>
		<dl>
			<dt>SUBJECT</dt>
			<dd><s:property value="resultClass.subject"/></dd>
			<dt>WRITER</dt>
			<dd><s:property value="resultClass.nickname"/></dd>
		</dl>
	</div><!-- text -->
	<div class="float_l content"><s:property value="resultClass.content" /></div>
</div><!-- event_modul -->

<p class="align_r">
<s:url id="modifyURL" action="reviewModifyForm">
	<s:param name="no">
		<s:property value="no" />
	</s:param>
</s:url>
<s:url id="deleteURL" action="reviewDeleteAction">
	<s:param name="no">
		<s:property value="no" />
	</s:param>
</s:url>
<p class="align_r">
	<s:if test="#session.session_isadmin == 1">
	<input type="button" value="수정" class="inputb" onClick="javascript:remodifyCheck('<s:property value="no"/>','<s:property value="currentPage" />');">
	<input type="button" value="삭제" class="inputb" onClick="javascript:redeleteCheck('<s:property value="no"/>','<s:property value="currentPage" />');">
	</s:if>
	<input name="list" type="button" value="목록" class="inputb" onClick="javascript:location.href='reviewListAction.action?currentPage=<s:property value="currentPage" />'">
</p>

<h3><strong>COMMENT</strong></h3>
<table class="table_list">
	<colgroup>
		<col width="90px" />
		<col width="90px" />
		<col />
		<col width="90px" />
		<col width="90px" />
	</colgroup>
	<tr>
		<th>ID</th>
		<th>NICKNAME</th>
		<th>COMMENT</th>
		<th>DEL</th>
		<th>DATE</th>
	</tr>
	<s:iterator value="commentlist" status="stat">
	<tr>
		<td><s:property value="id" /></td>
		<td><s:property value="nickname" /></td>
		<td><s:property value="content" /></td>
		<td>
			<s:if test="#session.session_id == id">
			<a href="javascript:deleteCheck('<s:property value="no"/>','<s:property value="currentPage" />','<s:property value="originno" />');"><font color="red"><strong>DEL</strong></font></a>
			</s:if>
		</td>
		<td><s:property value="regdate" /></td>
	</tr>
	</s:iterator>
	<s:if test="commentlist.size() <= 0">
	<tr>
		<td colspan="5">
			작성된 코멘트가 없습니다. 
		</td>
	</tr>
	</s:if>	
</table>
<form action="reviewWriteCommentAction.action" method="post"enctype="multipart/form-data"onsubmit="return commentCheck();">
<fieldset>
<legend>덧글쓰기</legend>
	<s:hidden name="originno" value="%{resultClass.no}" />
	<s:hidden name="no" value="%{resultClass.no}" />
	<s:hidden name="currentPage" value="%{currentPage}" />
	<table>
		<tr>
			<td>
				<input type="text" name="id" value="${session.session_id}" maxlength="20" readonly="readonly" class="align_c"/>
				<input type="text" name="nickname" value="${session.session_nickname}" maxlength="20" readonly="readonly" class="align_c"/>
			</td>
			<td>
				<s:textarea name="content" theme="simple" value="" cols="60" rows="3" />
			</td>
			<td><input name="submit" type="submit" value="WRITE" /></td>
		</tr>
	</table>
</fieldset>
</form>

